<?php


namespace app\index\model;


use think\Model;

class FacebookPage extends Model
{
    public static function getHomePageList($search_param, $page_param): array
    {
        $FacebookPage=new self();

        $where['del_flag']=['=',0];
        if(!empty($search_param['page_id'])) {
            $where['page_id'] = ['=', $search_param['page_id']];
        }
        if(is_numeric($search_param['id'])) {
            $where['id'] = ['=', $search_param['id']];
        }

        $obj=$FacebookPage->where($where)
            ->field('id,page_id,page_name')
            ->paginate($page_param['page_size'],false,['page'=>$page_param['page_num']]);
        if($obj->isEmpty()){
            return ['status'=>true,'result'=>['product'=>[],'total'=>0]];
        }
        $count=$obj->total();
        $data=$obj->items();

        return ['status'=>true,'result'=>['product'=>$data,'total'=>$count]];
    }

}